package org.example.book.normal.state.order.controller;

import org.example.book.normal.state.order.DeprecateOrder;
import org.example.book.normal.state.order.service.DeprecatedOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jeff
 */
@RestController
@RequestMapping("/deprecated/order")
public class DeprecatedOrderController {

    @Autowired
    private DeprecatedOrderService orderService;
    @PostMapping("/create")
    public DeprecateOrder createOrder(@RequestBody String productId) {
        return orderService.createOrder(productId);
    }

    @PostMapping("/pay")
    public DeprecateOrder payOrder(@RequestBody String orderId) {
        return orderService.pay(orderId);
    }

    @PostMapping("/send")
    public DeprecateOrder sendOrder(@RequestBody String orderId) {
        return orderService.send(orderId);
    }

    @PostMapping("/receive")
    public DeprecateOrder receiveOrder(@RequestBody String orderId) {
        return orderService.receive(orderId);
    }
}
